package com.mx.project.services.impl;

import com.mx.project.dao.SLoveMapper;
import com.mx.project.pojo.SLove;
import com.mx.project.vo.SLoveInfo;
import com.mx.project.services.SLoveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class SLoveServiceImpl implements SLoveService {
    @Autowired
    private SLoveMapper sLoveMapper;


    @Override
    public int addSLove(Integer uid, Integer pid) {
        SLove sLove = new SLove();
        sLove.setCreateTime(new Date());
        sLove.setPid(pid);
        sLove.setUid(uid);
        return sLoveMapper.insertSelective(sLove);
    }

    @Override
    public List<SLoveInfo> getSLoveByUid(Integer uid) {
        return sLoveMapper.selectSLoveInfoByUid(uid);
    }

    @Override
    public int removeSLoveByUidAndPid(Integer uid, Integer pid) {
        return sLoveMapper.deleteByUidAndPid(uid,pid);
    }

    @Override
    public SLove getSLoveByUidAndPid(Integer uid, Integer pid) {
        return sLoveMapper.selectByUidAndPid(uid,pid);
    }
}
